/**
 * The BrikPins class is used to manipulate the JwiK™ Brik IO.  It is comprised of static enumerations
 * and native method calls.  The logic for this class is implemented in C using the native method
 * interface.
 * 
 * @author      Steve Montgomery
 * @version     %I%, %G%
 * @since       1.0
 */
public class BrikPins
{
	/**
	 * Analog0 Pin
	 */
	public final static int Analog0=0;
	/**
	 * Analog1 Pin
	 */
	public final static int Analog1=1;
	/**
	 * Analog2 Pin
	 */
	public final static int Analog2=2;
	/**
	 * Analog3 Pin
	 */
	public final static int Analog3=3;
	/**
	 * Analog4 Pin
	 */
	public final static int Analog4=4;
	/**
	 * GPIO0 Pin
	 */
	public final static int GPIO0=5;
	/**
	 * GPIO1 Pin
	 */
	public final static int GPIO1=6;
	/**
	 * GPIO2 Pin
	 */
	public final static int GPIO2=7;
	/**
	 * GPIO3 Pin
	 */
	public final static int GPIO3=8;
	/**
	 * GPIO4 Pin
	 */
	public final static int GPIO4=9;
	/**
	 * GPIO5 Pin
	 */
	public final static int GPIO5=10;
	/**
	 * GPIO6 Pin
	 */
	public final static int GPIO6=11;
	/**
	 * GPIO7 Pin
	 */
	public final static int GPIO7=12;
	/**
	 * GPIO8 Pin
	 */
	public final static int GPIO8=13;
	/**
	 * GPIO9 Pin
	 */
	public final static int GPIO9=14;
	/**
	 * GPIO10 Pin
	 */
	public final static int GPIO10=15;
	/**
	 * GPIO11 Pin
	 */
	public final static int GPIO11=16;
	/**
	 * GPIO12 Pin
	 */
	public final static int GPIO12=17;
	/**
	 * GPIO13 Pin
	 */
	public final static int GPIO13=18;
	/**
	 * SCL Pin
	 */
	public final static int SCL = 19;
	/**
	 * SDA Pin
	 */
	public final static int SDA = 20;
	/**
	 * PWM0 Pin
	 */
	public final static int PWM0 = 21;
	/**
	 * PWM1 Pin
	 */
	public final static int PWM1 = 22;
	/**
	 * PWM2 Pin
	 */
	public final static int PWM2 = 23;
	/**
	 * PWM3 Pin
	 */
	public final static int PWM3 = 24;
	/**
	 * PWM4 Pin
	 */
	public final static int PWM4 = 25;
	/**
	 * PWM5 Pin
	 */
	public final static int PWM5 = 26;
	/**
	 * PWM6 Pin
	 */
	public final static int PWM6 = 27;
	/**
	 * PWM7 Pin
	 */
	public final static int PWM7 = 28;
	/**
	 * ON digital pin state
	 */
	public final static boolean ON = true;
	/**
	 * OFF digital pin state
	 */
	public final static boolean OFF = false;
	/**
	 * Input pin function
	 */
	public final static int INPUT=0;
	/**
	 * Output pin function
	 */
	public final static int OUTPUT=1;
	/**
	 * Tri-state pin function
	 */
	public final static int HIZ=2;
	/**
	 * Analog pin function
	 */
	public final static int ANALOG=3;
	/**
	 * I2C pin function
	 */
	public final static int I2C=4;
	/**
	 * PWM pin function
	 */
	public final static int PWM=5;
	/**
	 * Timerout pin function
	 */
	public final static int TIMEROUT=6;
	/**
	 * Counterin pin function
	 */
	public final static int COUNTERIN=7;
	
	/**
	 * Reads the IO state of a digital input.  Returns false if the specified pin is not 
	 * a digital input or output
	 *
	 * @param pin The pin to read
	 */
	public static native boolean ReadIoState(int pin);
	/**
	 * Sets the IO state of a digital output. 
	 *
	 * @param pin The pin to set
	 * @param state The desired pin state
	 */
	public static native void SetIoState(int pin, boolean state);
	/**
	 * Sets the function of a pin
	 *
	 * @param pin Pin to configure
	 * @param function Desired pin function
	 */
	public static native void SetIoFunction(int pin, int function);
	/**
	 * Sets the PWM value for a PWM pin.  Does nothing if the pin is not configured as PWM
	 *
	 * @param pin Pin to set
	 * @param value PWM value
	 */
	public static native void SetPwm(int pin, int value);
	/**
	 * Read analog value from analog pin.  Returns zero if pin is not configured as analog input
	 *
	 * @param pin Pin to read
	 */
	public static native int ReadAnalog(int pin);
	/**
	 * Set the timer output on and off period for a timer output pin.  Does nothing if the pin is not 
	 * configured as a timer output pin
	 *
	 * @param pin Pin to set 
	 * @param onPeriod On period for square wave
	 * @param offPeriod Off period for square wave
	 */
	public static native void SetTimerOutPeriod(int pin, int onPeriod, int offPeriod);	
	/**
	 * Reads the count of a counter input pin.  Returns a zero if pin is not configured as counter input.
	 *
	 * @param pin Pin to read
	 */	
	public static native int ReadCounter(int pin);
	/**
	 * Resets the counter for a counter input pin.  Does nothing if pin is not configured as counter input
	 *
	 * @param pin Pin to reset
	 */
	public static native void ResetCounter(int pin);

}